.\" $OpenBSD: snmpctl.8,v 1.21 2015/07/27 18:48:05 sobrado Exp $
.\"
.\" Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 27 2015 $
.Dt SNMPCTL 8
.Os
.Sh NAME
.Nm snmpctl
.Nd control the SNMP daemon
.Sh SYNOPSIS
.Nm
.Op Fl n
.Op Fl s Ar socket
.Ar command
.Op Ar arg ...
.Sh DESCRIPTION
The
.Nm
program controls the
.Xr snmpd 8
daemon.
Commands may be abbreviated to the minimum unambiguous prefix; for example,
.Cm s m
for
.Cm show mib .
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl n
Show numeric OID values instead of their symbolic names.
.It Fl s Ar socket
Use
.Ar socket
instead of the default
.Pa /var/run/snmpd.sock
to communicate with
.Xr snmpd 8 .
.El
.Pp
The following commands are available:
.Bl -tag -width Ds
.It Cm monitor
Monitor internal messages of the
.Xr snmpd 8
subsystems and engines.
.It Cm show mib
Dump the tree of compiled-in MIB objects.
.It Xo
.Cm snmp Ar request Ar host
.Op Ar options
.Xc
Request information from an SNMP agent that is running on the specified
.Ar host .
The
.Ar request
can be either
.Ic get ,
.Ic walk
or
.Ic bulkwalk
to retrieve a single SNMP value or a subtree.
The following
.Ar options
are supported:
.Pp
.Bl -tag -width bitstringXXXXXXXX -compact
.It Cm community Ar value
Set the SNMPv2 community; the default is
.Sq public .
.It Xo
.Cm oid
.Pq Ic all Ns | Ns Ar value
.Xc
Set the start OID; the default is
.Sq system .
This option can be specified multiple times.
.It Cm version Ar value
Set the SNMP version, either
.Ic 1
or
.Ic 2c .
The default is
.Ic 2c .
.El
.It Xo
.Cm trap send Ar oid-string
.Op Cm oid Ar oid-string Ar type value ...
.Xc
Send an SNMP trap via
.Xr snmpd 8
to the registered trap receivers.
The command takes one
.Ar oid-string
argument as the trap OID and optional varbind arguments with the specified
.Ar oid-string ,
.Ar type ,
and
.Ar value .
The following types are supported:
.Pp
.Bl -tag -width bitstringXXXXXXXX -compact
.It Cm ip Ar value
An IPv4 address.
.It Cm counter Ar value
A 32-bit counter.
.It Cm gauge Ar value
A 32-bit gauge.
.It Cm unsigned Ar value
A 32-bit unsigned integer.
.It Cm ticks Ar value
A 32-bit timeticks integer value.
.It Cm opaque Ar value
A 32-bit opaque.
.It Cm nsap Ar value
A 32-bit NSAP address.
.It Cm counter64 Ar value
A 64-bit counter.
.It Cm uint Ar value
A 32-bit unsigned integer.
.It Cm int Ar value
A 32-bit integer.
.It Cm bitstring Ar string
A bit string.
.It Cm string Ar string
An octet string.
.It Cm null
This type takes no argument.
.It Cm oid Ar oid-string
An string describing an Object ID, for example
.Ar 1.3.6.1.4.1.30155 .
.El
.It Cm walk Ar host
Alias for
.Ic snmp walk Ar host ,
see above.
.El
.Sh FILES
.Bl -tag -width "/var/run/snmpd.sockXX" -compact
.It Pa /var/run/snmpd.sock
default
.Ux Ns -domain
socket used for communication with
.Xr snmpd 8
.El
.Sh SEE ALSO
.Xr snmpd 8
.Sh HISTORY
The
.Nm
program first appeared in
.Ox 4.3 .
.Sh AUTHORS
The
.Nm
program was written by
.An Reyk Floeter Aq Mt reyk@openbsd.org .
